raviraj - Saturday, November 13, 2010 4:37 AM:
Hello All
i have Created Items ,Now for some Users i want to give Authorization to add New relationship but for Other User i don't want to give this Authorization so i want to hide that tab for a particular Item Relationship and not for all items....Through code How do I Hide It...?
Please Reply
Thanking You
Raviraj
Brian - Saturday, November 13, 2010 6:46 PM:
Hi Raviraj,
This code will hide all tabs on a form except those that contain "Document" in their label:
// basic code to hide tabs in the relationship toolbar
// call this from the "onFormPopulated" of a form
top.Basic_HideTabs_Logic = function() {
// If the tabbar is not yet ready, wait a bit and call the function recursively
if (!parent.relationships || !parent.relationships.relTabbarReady || parent.relationships.relTabbar.GetTabOrder("|") === "" ) {
setTimeout("top.Basic_HideTabs_Logic();", 30);
return;
}
var tabbar = parent.relationships.relTabbar;
var tabIds_array = tabbar.GetTabOrder("|").split("|");
for (var t=0; t<tabIds_array.length; t++)
{
var tabLabel = tabbar.GetTabLabel(tabIds_array[t]);
// test the tab label.
// IN this case hide it if it doesn't include "Document"
if ( tabLabel.indexOf("Document") < 0 )
{
tabbar.SetTabVisible(tabIds_array[t],false);
}
}
};
setTimeout("top.Basic_HideTabs_Logic();", 30);
This should give you a good place to start.
Cheers,
Brian.
raviraj - Monday, November 15, 2010 2:26 AM:
Thank you Brian for Your Reply....
But Actually I don't want to hide Total tabs because i want to just view the relationship and don't want to add in it.
actually i want hide the Button "New Relationship" from relationship tab for Few Tabs.
Thanking You
Raviraj
Brian - Tuesday, November 16, 2010 8:09 AM:
Hi Raviraj,
Hiding the toolbar buttons is potentially a lot of work. You have to be able to hide them each time the application would otherwise want to display them.
It should be easier to intercept the button press by using the Relationship Items Grid Events. For the onRowInsert of the grid create a method that just returns false; This should stop the call which creates the new relationship item/row for the relationship grid.
If you want you can put up an Alert message advising that this action has been disabled or you can just quietly ignore it.
Cheers,
Brian.
Brian - Thursday, November 18, 2010 4:13 AM:
Hi Raviraj,
It turns out that you can't get access to the relationship grid toolbar through code so you can't disable the toolbar buttons etc.
Your choices therefore are to do as above or to create a substitute relationship grid with the toolbar you want and replace the standard relationship grid. Like I said, a lot of work.
Cheers,
Brian.
